import axios from '@/utils/axios'

export const getIdiom = (id: string): Promise<ApiResult<LiteratureIdiomPO>> => {
  return axios.get(`literature/idiom/${id}`)
}

export const getIdiomPage = (
  pagination: Pagination,
  params: LiteratureIdiomPO
): Promise<ApiResult<Page<LiteratureIdiomPO>>> => {
  return axios.get(`literature/idiom/page/${pagination.page}/${pagination.pageSize}`, {
    params
  })
}

export const postOrPutIdiom = (data: LiteratureIdiomPO): Promise<ApiResult<null>> => {
  return axios.post(`literature/idiom`, data)
}

export const deleteIdiom = (id: string): Promise<ApiResult<null>> => {
  return axios.delete(`literature/idiom/${id}`)
}
